package com.junyidao.game.controller;

import com.junyidao.game.pojo.PCode;
import com.junyidao.game.service.CodeService;
import com.junyidao.game.service.SequenceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.autoconfigure.ActuatorMetricWriter;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * Created by HP on 2016/8/7.
 */
@Controller
@RequestMapping("/code")
public class CodeController {

    @Autowired
    private CodeService codeService;

    @Autowired
    private SequenceService sequenceService;

    @RequestMapping(value = "/list")
    @ResponseBody
    public PCode list() {
        List<PCode> code = codeService.getAll(new PCode());
        return code.get(0);
    }

    @RequestMapping(value = "/add")
    @ResponseBody
    public PCode add() {
        PCode code = new PCode();
        code.setCodeName("atest");
        code.setCodeSortId("01");
        code.setCodeValue("avalu");
        code.setCodeStatus("01");
        codeService.add(code);
        return code;
    }
}
